/**
 * 
 */
package lu.med.praxiswahl.wahlumed.client.briefe;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import javax.swing.*;
import lu.med.praxiswahl.wahlumed.client.wclient.Main;
import lu.med.praxiswahl.wahlumed.client.wclient.PatientenSuchmaske;

/**
 * @author PatrickPierre
 * 
 */
public class LetterManagementPanel extends JTabbedPane {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1186436365781916827L;

	private JPanel receivePanel, sentPanel;

	private static final String BRIEF_EINGANG = "Verwaltung Briefeingang";
	private static final String BRIEF_AUSGANG = "Verwaltung Briefausgang";

	private FunctionPanel funcPan;
	private JScrollPane tableScrollPane;
	private Main dataManager;
	private LetterModel sentModel;
	private PatientenSuchmaske search;
	private EntryTablePanel sentTablePanel;

	/**
	 * 
	 */
	public LetterManagementPanel(Main dataManager, PatientenSuchmaske search) {

		super();
		this.dataManager = dataManager;
		this.search = search;
		this.initComponent();
	}

	private void initComponent() {

		this.receivePanel = new JPanel();

		this.sentPanel = new JPanel(new GridLayout(0, 1));
		this.sentModel = new LetterModel(dataManager);
		sentTablePanel = new EntryTablePanel(sentModel);
		this.funcPan = new FunctionPanel(dataManager, this.sentTablePanel, search);
		this.sentPanel.add(this.funcPan, BorderLayout.NORTH);
		
		this.tableScrollPane = new JScrollPane();
		//this.tableScrollPane.setViewportView(sentTablePanel.getTable());
		//this.tableScrollPane = new JScrollPane(sentTablePanel.getTable());

		this.sentPanel.add(this.sentTablePanel, BorderLayout.SOUTH);

		this.addTab(BRIEF_AUSGANG, new javax.swing.ImageIcon(getClass()
				.getResource("/doctor_letter.png")), sentPanel);

		this.addTab(BRIEF_EINGANG, new javax.swing.ImageIcon(getClass()
				.getResource("/doctor_letter.png")), receivePanel);

	}

}
